<template>
    <div class="index">
        <Editor
            :content="content"
            @bindBody="bindBody"
            uploadImgUrl="https://jsonplaceholder.typicode.com/posts/"
            @uploadBefore="uploadBefore"
            @uploadProcess="uploadProcess"
            @uploadSuccess="uploadImage"
            @uploadFailed="uploadFailed"
            @uploadError="uploadError"
        ></Editor>
    </div>
</template>
<script>
import Editor from "@/components/editor.vue";

export default {
    data() {
        return {
            content: "<p>hello</p>"
        };
    },
    mounted() {
    },
    methods: {
        // 绑定富文本内容
        bindBody(e) {
            this.content = e
        },
        // 上傳之前
        uploadBefore(e) {
            console.log(e);
        },
        uploadProcess(e) {
            console.log(e)
        },
        // 文件上傳回調
        uploadImage(file, res) {
            console.log(e)
        },
        uploadFailed(file, res) {
            console.log(file, res)
        },
        uploadError(file, error, result) {
            console.log(file, error, result)
        }
    },
    components: {
        Editor
    }
}
</script>

<style scoped>

</style>
